package com.universalInterface.common.base;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author Lx
 * @date 2023/12/8 16:16
 * @description 基础实体
 */
@Data
public abstract class BaseEntity implements Serializable {

	private static final long serialVersionUID = -5495499906688277746L;

	/**
	 * com.baomidou.mybatisplus.core.toolkit.IdWorker : id获取器（MybatisPlus统一id生成策略）
	 */
	@TableId(value = "id", type = IdType.ASSIGN_ID)
	@Schema(name = "id", description = "主键id, 唯一")
	public Long id;

	/**
	 * 创建者
	 */
	// @Transient
	// @Schema(name = "createBy", description = "创建者")
	// @TableField(value = "create_by", fill = FieldFill.INSERT)
	// private String createBy;

	/**
	 * 创建时间
	 */
	// @Transient
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@Schema(name = "createTime", description = "创建时间")
	@TableField(value = "create_time", fill = FieldFill.INSERT)
	private LocalDateTime createTime;

	/**
	 * 更新者
	 */
	// @Transient
	// @Schema(name = "updateBy", description = "更新者")
	// @TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE)
	// private String updateBy;

	/**
	 * 更新时间
	 */
	// @Transient
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@Schema(name = "updateTime", description = "更新时间")
	@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
	private LocalDateTime updateTime;

	// /**
	//  * 逻辑删除
	//  * <br/> @TableLogic注解是逻辑删除，并不会永久删除数据
	//  */
	// @Transient
	// @TableLogic(value = "0", delval = "1")
	// @Schema(name = "isDeleted", description = "逻辑删除")
	// @TableField(value = "is_deleted")
	// private Integer isDeleted;

}
